package com.noshufou.android.su;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import com.noshufou.android.su.util.Util;

public class PinActivity extends Activity
  implements View.OnClickListener
{
  public static final String EXTRA_ATTEMPTS_ALLOWED = "attempts_allowed";
  public static final String EXTRA_MODE = "mode";
  public static final String EXTRA_PIN = "pin";
  public static final String EXTRA_SECRET_CODE = "secret_code";
  public static final int MODE_CHANGE = 2;
  public static final int MODE_CHECK = 3;
  public static final int MODE_NEW = 1;
  public static final int MODE_SECRET_CODE = 4;
  private int mAttempts = 0;
  private int mAttemptsAllowed = 3;
  private int mMode = 0;
  private int mOriginalHintTextColor;
  private String mPinConfirm = "";
  private EditText mPinText;

  private void onOk()
  {
    if (this.mPinText.getText().equals(""));
    while (true)
    {
      return;
      switch (this.mMode)
      {
      default:
        break;
      case 1:
        String str = this.mPinText.getText().toString();
        if (this.mPinConfirm.equals(""))
        {
          this.mPinConfirm = this.mPinText.getText().toString();
          this.mPinText.setText("");
          this.mPinText.setHint(2131427509);
          this.mPinText.setHintTextColor(this.mOriginalHintTextColor);
          continue;
        }
        if (str.equals(this.mPinConfirm))
        {
          Intent localIntent2 = new Intent();
          localIntent2.putExtra("pin", Util.getHash(str));
          setResult(-1, localIntent2);
          finish();
          continue;
        }
        this.mPinConfirm = "";
        this.mPinText.setText("");
        this.mPinText.setHint(2131427510);
        this.mPinText.setHintTextColor(-65536);
        break;
      case 2:
      case 3:
        if (Util.checkPin(this, this.mPinText.getText().toString()))
        {
          if (this.mMode == 3)
          {
            setResult(-1);
            finish();
            continue;
          }
          this.mPinText.setText("");
          this.mPinText.setHint(2131427508);
          this.mPinText.setHintTextColor(this.mOriginalHintTextColor);
          this.mMode = 1;
          continue;
        }
        if (1 + this.mAttempts < this.mAttemptsAllowed)
        {
          this.mAttempts = (1 + this.mAttempts);
          this.mPinText.setText("");
          EditText localEditText = this.mPinText;
          Resources localResources = getResources();
          int i = this.mAttemptsAllowed - this.mAttempts;
          Object[] arrayOfObject = new Object[1];
          arrayOfObject[0] = Integer.valueOf(this.mAttemptsAllowed - this.mAttempts);
          localEditText.setHint(localResources.getQuantityString(2131492866, i, arrayOfObject));
          this.mPinText.setHintTextColor(-65536);
          continue;
        }
        setResult(0);
        finish();
        break;
      case 4:
        Intent localIntent1 = new Intent();
        localIntent1.putExtra("secret_code", this.mPinText.getText());
        setResult(-1, localIntent1);
        finish();
      }
    }
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    default:
    case 2131361866:
    case 2131361856:
    case 2131361857:
    case 2131361858:
    case 2131361859:
    case 2131361860:
    case 2131361861:
    case 2131361862:
    case 2131361863:
    case 2131361864:
    case 2131361865:
    case 2131361867:
    }
    while (true)
    {
      return;
      this.mPinText.append("0");
      continue;
      this.mPinText.append("1");
      continue;
      this.mPinText.append("2");
      continue;
      this.mPinText.append("3");
      continue;
      this.mPinText.append("4");
      continue;
      this.mPinText.append("5");
      continue;
      this.mPinText.append("6");
      continue;
      this.mPinText.append("7");
      continue;
      this.mPinText.append("8");
      continue;
      this.mPinText.append("9");
      continue;
      onOk();
      continue;
      setResult(0);
      finish();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903043);
    this.mPinText = ((EditText)findViewById(2131361855));
    this.mOriginalHintTextColor = this.mPinText.getCurrentHintTextColor();
    ((Button)findViewById(2131361866)).setOnClickListener(this);
    ((Button)findViewById(2131361856)).setOnClickListener(this);
    ((Button)findViewById(2131361857)).setOnClickListener(this);
    ((Button)findViewById(2131361858)).setOnClickListener(this);
    ((Button)findViewById(2131361859)).setOnClickListener(this);
    ((Button)findViewById(2131361860)).setOnClickListener(this);
    ((Button)findViewById(2131361861)).setOnClickListener(this);
    ((Button)findViewById(2131361862)).setOnClickListener(this);
    ((Button)findViewById(2131361863)).setOnClickListener(this);
    ((Button)findViewById(2131361864)).setOnClickListener(this);
    Button localButton1 = (Button)findViewById(2131361865);
    localButton1.setOnClickListener(this);
    localButton1.setText(2131427351);
    Button localButton2 = (Button)findViewById(2131361867);
    localButton2.setOnClickListener(this);
    localButton2.setText(2131427354);
    this.mMode = getIntent().getIntExtra("mode", 0);
    switch (this.mMode)
    {
    default:
      throw new IllegalArgumentException("You must specify an operating mode");
    case 1:
      this.mPinText.setHint(2131427508);
    case 2:
    case 3:
    case 4:
    }
    while (true)
    {
      if (getIntent().hasExtra("attempts_allowed"))
        this.mAttemptsAllowed = getIntent().getIntExtra("attempts_allowed", 0);
      return;
      this.mPinText.setHint(2131427507);
      continue;
      this.mPinText.setVisibility(8);
      this.mPinText = ((EditText)findViewById(2131361806));
      findViewById(2131361805).setVisibility(0);
    }
  }
}

/* Location:           D:\Development\Decompile_Workspace\슈퍼유저-41\classes_dex2jar.jar
 * Qualified Name:     com.noshufou.android.su.PinActivity
 * JD-Core Version:    0.6.0
 */